<template>
  <div cless="Top"  style="margin-left: 100px; display: flex;  justify-content: center;">
    <el-form label-width="100px" :rules="rules" ref="rules" :model="form" >
      <el-form-item label="用户名:" prop="account">
        <el-input v-model="form.account"></el-input>
      </el-form-item>
      <el-form-item label="密码:" prop="password">
        <el-input v-model="form.password" show-password></el-input>
      </el-form-item>
      <el-button type="primary" @click="denglu" style="margin-left: 150px;" round>登录</el-button>
    </el-form>
  </div>
</template>

<script>
export default {
  name: 'loGin',
  data() {
    return {
      form: {
        account: 'itheima001',
        password: 'itheima001'
      },
      rules: {
        account: [
          { required: true, message: '账户不能为空', trigger: 'blur' },
          { min: 8,  message: '账户不能低于8位', trigger: 'blur' }
        ],
        password: [ 
          { required: true, message: '密码不能为空', trigger: 'blur' },
            { min: 8,  message: '密码不能低于8位', trigger: 'blur' }
          ]
      },
      count:100,
    }
  },
  methods: {
    denglu() {
      this.$refs.rules.validate((valid) => {
          if (valid) {
            this.$router.push('/HelloWorld')
          } 
        });
    }
  },

}
</script>

<style lang="sass" scoped>
</style>